{extend name='template/base'}{/extend}
{block name='title'}{/block}
{block name='style'}{/block}
{block name='script'}{/block}
{block name='footer'}{/block}
{block name='content'}
<body>
<header class="header">
    <div>
        <a class="back" href="{:url('shop/shop/index')}"><i class="iconfont icon-zuoyoujiantou-copy-copy-copy"></i></a>
        购物车
    </div>
</header>
<div class="pages" id="cart_page">
    {if condition="!empty($list)"}
    <div class="list-form other">
        {volist name="list" id="vo"}
        <ul id="ul_{$vo['id']}">
            <li>
                {if condition='$vo.enable==1' }
                <div class="checkbox-view absmiddle-left">
                    <input type="checkbox" name="all_check"  {if condition='$vo.check==true' } checked="true" {/if}  @change="all_check({$vo['id']})" >
                </div>
                {/if}
                <div>
                    <div class="edit-title">{$vo['name']}</div>

                    <span class="edit" @tap.stop="edit({$vo['id']},{$vo['total_price']},{$total_price})">编辑</span>

                </div>
            </li>
            <li class="goods-list">
                <ul id="{$vo['id']}">
                    {volist name="vo['items']" id="item"}
                    <li id="li_{$item['cart_id']}">
                        {if condition='$item.enable==1' }
                        <div class="checkbox-view absmiddle-left">
                            <input type="checkbox"  name="checkbox"   {if condition='$item.flag_choose==1' } checked="true" {/if}  @change="check({$item['cart_id']},{$vo['id']},{$item.price},{$item.id})" value="{$item.cart_id}">
                        </div>
                        {/if}
                        <div class="img"><img src="{$item['cover_image']}" height="441" width="500"/></div>
                        <div class="text">
                            <div class="title">{$item['name']}</div>
                            <p>

                                {if condition='$item.enable==0' }
                                    <span class="color-primary">此商品已下架</span>
                                {else/}
                                x<span>{$item['num']}</span>
                                {/if}

                                <span class="pull-right color-primary">￥{$item['price']}</span>
                            </p>
                        </div>
                        <div class="hidden">
                            <div class="box">
                                {if condition='$item.enable==1' }
                                <div class="l">
                                    <div class="calc">
                                        <span @tap.stop="down_tap({$vo['id']},{$item.price},{$item.id},{$item.cart_variant_id},{$item['cart_id']})" class="down"><i
                                                class="iconfont icon-wuuiconsuoxiao"></i></span>
                                        <input type="tel" readonly class="num" value="{$item['num']}" maxlength="3">
                                        <span @tap.stop="up_tap({$vo['id']},{$item.price},{$item.id},{$item.cart_variant_id},{$item.cart_id})" class="up"><i
                                                class="iconfont icon-wuuiconxiangjifangda"></i></span>
                                    </div>
                                </div>
                                {/if}
                                <div class="r">
                                    <a @tap.stop="del_btn({$vo['id']},{$item['id']},{$item.price},{$item['cart_id']})"
                                       class="delete">删除</a>
                                </div>
                            </div>
                        </div>
                    </li>
                    {/volist}
                </ul>
            </li>
            <li>小计：￥<span id="span_{$vo['id']}" class="color-primary total_prcie_span">{$vo['total_price']}</span></li>
        </ul>
        {/volist}
    </div>
    <div class="foot-btn">
        <div>
            <i  class="iconfont icon-gouwuche"></i>
            <span id="total_price">{$total_price}</span>元
            <a @tap="send_btn()" id="send_btn" class="btn">去结算</a>
        </div>
    </div>
    {else /}
    <div class="tip-icon" >
        <i class="iconfont icon-gouwuchekong"></i>
        <p>空空如也</p>
    </div>
    {/if}
</div>
{/block}
{block name='script_extra'}
<script>
    var list_url = "{:url('shop/Goods/detail')}";
    var add_cart_url = "{:url('cart/Cart/add_cart')}";
    var send_order_url = "{:url('order/Order/send_order')}";
    var delete_cart_item_url = "{:url('cart/Cart/delete')}";
    var check_url = "{:url('cart/Cart/check')}";
    var un_check_url = "{:url('cart/Cart/un_check')}";
    var buy = "{$buy}";
    if(buy!=="0"){
        buy = buy.split(",");
    }
    else {
        buy = [];
    }
    require(['cart/index']);
</script>
{/block}